from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys

class Base():
    def __init__(self,driver):
        self.driver = driver

    def open(self,url):
        self.driver.get(url)

    def find_element(self,loc):
        return self.driver.find_element(*loc)

    def click(self,loc):
        self.find_element(loc).click()

    def send_keys(self,loc,info):
        self.find_element(loc).send_keys(info)

    def double_click(self,loc):
        ActionChains(self.driver).double_click(self.find_element(loc)).perform()

    def jp_enter(self,loc):
        self.send_keys(loc,Keys.ENTER)

    def window(self):
        self.driver.switch_to.window(self.driver.window_handles[-1])